package com.unf.edu.rms.controller.validation;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import com.unf.edu.rms.controller.faculty.FacultyController;
import com.unf.edu.rms.dao.Faculty;

public class FacultyValidator implements Validator{

	@Override
	public boolean supports(Class<?> arg0) {
		return FacultyController.class.equals(arg0);
		
	}

	@Override
	public void validate(Object obj, Errors errors) {
		System.out.println("UserLoginValidator.validate()==============");
		Faculty faculty = (Faculty)obj;
		ValidationUtils.rejectIfEmpty(errors, "nnumber", "error.nnumber.required");
		ValidationUtils.rejectIfEmpty(errors, "firstName", "error.firstname.required");
		ValidationUtils.rejectIfEmpty(errors, "lastName", "error.lastname.required");
		ValidationUtils.rejectIfEmpty(errors, "email", "error.email.required");
		
	}
}
